<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - Lua 5.1.5 - src/ldo.c</title>
  <link rel="stylesheet" type="text/css" href="../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../index.html">top level</a> - <a href="index.html">src</a> - ldo.c</td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">Lua 5.1.5</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">228</td>
            <td class="headerCovTableEntry">283</td>
            <td class="headerCovTableEntryMed">80.6 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2019-06-13 19:44:15</td>
            <td></td>
          </tr>
          <tr>
            <td class="headerItem">Legend:</td>
            <td class="headerValueLeg">            Lines:
            <span class="coverLegendCov">hit</span>
            <span class="coverLegendNoCov">not hit</span>
</td>
            <td></td>
          </tr>
          <tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">          Line data    Source code</pre>
<pre class="source">
<span class="lineNum">       1 </span>            : /*
<span class="lineNum">       2 </span>            : ** $Id: ldo.c,v 2.38.1.4 2012/01/18 02:27:10 roberto Exp $
<span class="lineNum">       3 </span>            : ** Stack and Call structure of Lua
<span class="lineNum">       4 </span>            : ** See Copyright Notice in lua.h
<span class="lineNum">       5 </span>            : */
<span class="lineNum">       6 </span>            : 
<span class="lineNum">       7 </span>            : 
<span class="lineNum">       8 </span>            : #include &lt;setjmp.h&gt;
<span class="lineNum">       9 </span>            : #include &lt;stdlib.h&gt;
<span class="lineNum">      10 </span>            : #include &lt;string.h&gt;
<span class="lineNum">      11 </span>            : 
<span class="lineNum">      12 </span>            : #define ldo_c
<span class="lineNum">      13 </span>            : #define LUA_CORE
<span class="lineNum">      14 </span>            : 
<span class="lineNum">      15 </span>            : #include &quot;lua.h&quot;
<span class="lineNum">      16 </span>            : 
<span class="lineNum">      17 </span>            : #include &quot;ldebug.h&quot;
<span class="lineNum">      18 </span>            : #include &quot;ldo.h&quot;
<span class="lineNum">      19 </span>            : #include &quot;lfunc.h&quot;
<span class="lineNum">      20 </span>            : #include &quot;lgc.h&quot;
<span class="lineNum">      21 </span>            : #include &quot;lmem.h&quot;
<span class="lineNum">      22 </span>            : #include &quot;lobject.h&quot;
<span class="lineNum">      23 </span>            : #include &quot;lopcodes.h&quot;
<span class="lineNum">      24 </span>            : #include &quot;lparser.h&quot;
<span class="lineNum">      25 </span>            : #include &quot;lstate.h&quot;
<span class="lineNum">      26 </span>            : #include &quot;lstring.h&quot;
<span class="lineNum">      27 </span>            : #include &quot;ltable.h&quot;
<span class="lineNum">      28 </span>            : #include &quot;ltm.h&quot;
<span class="lineNum">      29 </span>            : #include &quot;lundump.h&quot;
<span class="lineNum">      30 </span>            : #include &quot;lvm.h&quot;
<span class="lineNum">      31 </span>            : #include &quot;lzio.h&quot;
<span class="lineNum">      32 </span>            : 
<span class="lineNum">      33 </span>            : 
<span class="lineNum">      34 </span>            : 
<span class="lineNum">      35 </span>            : 
<span class="lineNum">      36 </span>            : /*
<span class="lineNum">      37 </span>            : ** {======================================================
<span class="lineNum">      38 </span>            : ** Error-recovery functions
<span class="lineNum">      39 </span>            : ** =======================================================
<span class="lineNum">      40 </span>            : */
<span class="lineNum">      41 </span>            : 
<span class="lineNum">      42 </span>            : 
<span class="lineNum">      43 </span>            : /* chain list of long jump buffers */
<span class="lineNum">      44 </span>            : struct lua_longjmp {
<span class="lineNum">      45 </span>            :   struct lua_longjmp *previous;
<span class="lineNum">      46 </span>            :   luai_jmpbuf b;
<span class="lineNum">      47 </span>            :   volatile int status;  /* error code */
<span class="lineNum">      48 </span>            : };
<span class="lineNum">      49 </span>            : 
<span class="lineNum">      50 </span>            : 
<span class="lineNum">      51 </span><span class="lineCov">        372 : void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop) {</span>
<span class="lineNum">      52 </span><span class="lineCov">        372 :   switch (errcode) {</span>
<span class="lineNum">      53 </span><span class="lineNoCov">          0 :     case LUA_ERRMEM: {</span>
<span class="lineNum">      54 </span><span class="lineNoCov">          0 :       setsvalue2s(L, oldtop, luaS_newliteral(L, MEMERRMSG));</span>
<span class="lineNum">      55 </span><span class="lineNoCov">          0 :       break;</span>
<span class="lineNum">      56 </span>            :     }
<span class="lineNum">      57 </span><span class="lineCov">          1 :     case LUA_ERRERR: {</span>
<span class="lineNum">      58 </span><span class="lineCov">          1 :       setsvalue2s(L, oldtop, luaS_newliteral(L, &quot;error in error handling&quot;));</span>
<span class="lineNum">      59 </span><span class="lineCov">          1 :       break;</span>
<span class="lineNum">      60 </span>            :     }
<span class="lineNum">      61 </span><span class="lineCov">        371 :     case LUA_ERRSYNTAX:</span>
<span class="lineNum">      62 </span>            :     case LUA_ERRRUN: {
<span class="lineNum">      63 </span><span class="lineCov">        371 :       setobjs2s(L, oldtop, L-&gt;top - 1);  /* error message on current top */</span>
<span class="lineNum">      64 </span><span class="lineCov">        371 :       break;</span>
<span class="lineNum">      65 </span>            :     }
<span class="lineNum">      66 </span>            :   }
<span class="lineNum">      67 </span><span class="lineCov">        372 :   L-&gt;top = oldtop + 1;</span>
<span class="lineNum">      68 </span><span class="lineCov">        372 : }</span>
<span class="lineNum">      69 </span>            : 
<span class="lineNum">      70 </span>            : 
<span class="lineNum">      71 </span><span class="lineCov">        371 : static void restore_stack_limit (lua_State *L) {</span>
<span class="lineNum">      72 </span>            :   lua_assert(L-&gt;stack_last - L-&gt;stack == L-&gt;stacksize - EXTRA_STACK - 1);
<span class="lineNum">      73 </span><span class="lineCov">        371 :   if (L-&gt;size_ci &gt; LUAI_MAXCALLS) {  /* there was an overflow? */</span>
<span class="lineNum">      74 </span><span class="lineNoCov">          0 :     int inuse = cast_int(L-&gt;ci - L-&gt;base_ci);</span>
<span class="lineNum">      75 </span><span class="lineNoCov">          0 :     if (inuse + 1 &lt; LUAI_MAXCALLS)  /* can `undo' overflow? */</span>
<span class="lineNum">      76 </span><span class="lineNoCov">          0 :       luaD_reallocCI(L, LUAI_MAXCALLS);</span>
<span class="lineNum">      77 </span>            :   }
<span class="lineNum">      78 </span><span class="lineCov">        371 : }</span>
<span class="lineNum">      79 </span>            : 
<span class="lineNum">      80 </span>            : 
<span class="lineNum">      81 </span><span class="lineNoCov">          0 : static void resetstack (lua_State *L, int status) {</span>
<span class="lineNum">      82 </span><span class="lineNoCov">          0 :   L-&gt;ci = L-&gt;base_ci;</span>
<span class="lineNum">      83 </span><span class="lineNoCov">          0 :   L-&gt;base = L-&gt;ci-&gt;base;</span>
<span class="lineNum">      84 </span><span class="lineNoCov">          0 :   luaF_close(L, L-&gt;base);  /* close eventual pending closures */</span>
<span class="lineNum">      85 </span><span class="lineNoCov">          0 :   luaD_seterrorobj(L, status, L-&gt;base);</span>
<span class="lineNum">      86 </span><span class="lineNoCov">          0 :   L-&gt;nCcalls = L-&gt;baseCcalls;</span>
<span class="lineNum">      87 </span><span class="lineNoCov">          0 :   L-&gt;allowhook = 1;</span>
<span class="lineNum">      88 </span><span class="lineNoCov">          0 :   restore_stack_limit(L);</span>
<span class="lineNum">      89 </span><span class="lineNoCov">          0 :   L-&gt;errfunc = 0;</span>
<span class="lineNum">      90 </span><span class="lineNoCov">          0 :   L-&gt;errorJmp = NULL;</span>
<span class="lineNum">      91 </span><span class="lineNoCov">          0 : }</span>
<span class="lineNum">      92 </span>            : 
<span class="lineNum">      93 </span>            : 
<span class="lineNum">      94 </span><span class="lineCov">        372 : void luaD_throw (lua_State *L, int errcode) {</span>
<span class="lineNum">      95 </span><span class="lineCov">        372 :   if (L-&gt;errorJmp) {</span>
<span class="lineNum">      96 </span><span class="lineCov">        372 :     L-&gt;errorJmp-&gt;status = errcode;</span>
<span class="lineNum">      97 </span><span class="lineCov">        372 :     LUAI_THROW(L, L-&gt;errorJmp);</span>
<span class="lineNum">      98 </span>            :   }
<span class="lineNum">      99 </span>            :   else {
<span class="lineNum">     100 </span><span class="lineNoCov">          0 :     L-&gt;status = cast_byte(errcode);</span>
<span class="lineNum">     101 </span><span class="lineNoCov">          0 :     if (G(L)-&gt;panic) {</span>
<span class="lineNum">     102 </span><span class="lineNoCov">          0 :       resetstack(L, errcode);</span>
<span class="lineNum">     103 </span>            :       lua_unlock(L);
<span class="lineNum">     104 </span><span class="lineNoCov">          0 :       G(L)-&gt;panic(L);</span>
<span class="lineNum">     105 </span>            :     }
<span class="lineNum">     106 </span><span class="lineNoCov">          0 :     exit(EXIT_FAILURE);</span>
<span class="lineNum">     107 </span>            :   }
<span class="lineNum">     108 </span>            : }
<span class="lineNum">     109 </span>            : 
<span class="lineNum">     110 </span>            : 
<span class="lineNum">     111 </span><span class="lineCov">       7464 : int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) {</span>
<span class="lineNum">     112 </span>            :   struct lua_longjmp lj;
<span class="lineNum">     113 </span><span class="lineCov">       7464 :   lj.status = 0;</span>
<span class="lineNum">     114 </span><span class="lineCov">       7464 :   lj.previous = L-&gt;errorJmp;  /* chain new error handler */</span>
<span class="lineNum">     115 </span><span class="lineCov">       7464 :   L-&gt;errorJmp = &amp;lj;</span>
<span class="lineNum">     116 </span><span class="lineCov">       7464 :   LUAI_TRY(L, &amp;lj,</span>
<span class="lineNum">     117 </span>            :     (*f)(L, ud);
<span class="lineNum">     118 </span>            :   );
<span class="lineNum">     119 </span><span class="lineCov">       7447 :   L-&gt;errorJmp = lj.previous;  /* restore old error handler */</span>
<span class="lineNum">     120 </span><span class="lineCov">       7447 :   return lj.status;</span>
<span class="lineNum">     121 </span>            : }
<span class="lineNum">     122 </span>            : 
<span class="lineNum">     123 </span>            : /* }====================================================== */
<span class="lineNum">     124 </span>            : 
<span class="lineNum">     125 </span>            : 
<span class="lineNum">     126 </span><span class="lineCov">         57 : static void correctstack (lua_State *L, TValue *oldstack) {</span>
<span class="lineNum">     127 </span>            :   CallInfo *ci;
<span class="lineNum">     128 </span>            :   GCObject *up;
<span class="lineNum">     129 </span><span class="lineCov">         57 :   L-&gt;top = (L-&gt;top - oldstack) + L-&gt;stack;</span>
<span class="lineNum">     130 </span><span class="lineCov">       1111 :   for (up = L-&gt;openupval; up != NULL; up = up-&gt;gch.next)</span>
<span class="lineNum">     131 </span><span class="lineCov">       1054 :     gco2uv(up)-&gt;v = (gco2uv(up)-&gt;v - oldstack) + L-&gt;stack;</span>
<span class="lineNum">     132 </span><span class="lineCov">        588 :   for (ci = L-&gt;base_ci; ci &lt;= L-&gt;ci; ci++) {</span>
<span class="lineNum">     133 </span><span class="lineCov">        531 :     ci-&gt;top = (ci-&gt;top - oldstack) + L-&gt;stack;</span>
<span class="lineNum">     134 </span><span class="lineCov">        531 :     ci-&gt;base = (ci-&gt;base - oldstack) + L-&gt;stack;</span>
<span class="lineNum">     135 </span><span class="lineCov">        531 :     ci-&gt;func = (ci-&gt;func - oldstack) + L-&gt;stack;</span>
<span class="lineNum">     136 </span>            :   }
<span class="lineNum">     137 </span><span class="lineCov">         57 :   L-&gt;base = (L-&gt;base - oldstack) + L-&gt;stack;</span>
<span class="lineNum">     138 </span><span class="lineCov">         57 : }</span>
<span class="lineNum">     139 </span>            : 
<span class="lineNum">     140 </span>            : 
<span class="lineNum">     141 </span><span class="lineCov">         57 : void luaD_reallocstack (lua_State *L, int newsize) {</span>
<span class="lineNum">     142 </span><span class="lineCov">         57 :   TValue *oldstack = L-&gt;stack;</span>
<span class="lineNum">     143 </span><span class="lineCov">         57 :   int realsize = newsize + 1 + EXTRA_STACK;</span>
<span class="lineNum">     144 </span>            :   lua_assert(L-&gt;stack_last - L-&gt;stack == L-&gt;stacksize - EXTRA_STACK - 1);
<span class="lineNum">     145 </span><span class="lineCov">         57 :   luaM_reallocvector(L, L-&gt;stack, L-&gt;stacksize, realsize, TValue);</span>
<span class="lineNum">     146 </span><span class="lineCov">         57 :   L-&gt;stacksize = realsize;</span>
<span class="lineNum">     147 </span><span class="lineCov">         57 :   L-&gt;stack_last = L-&gt;stack+newsize;</span>
<span class="lineNum">     148 </span><span class="lineCov">         57 :   correctstack(L, oldstack);</span>
<span class="lineNum">     149 </span><span class="lineCov">         57 : }</span>
<span class="lineNum">     150 </span>            : 
<span class="lineNum">     151 </span>            : 
<span class="lineNum">     152 </span><span class="lineCov">          9 : void luaD_reallocCI (lua_State *L, int newsize) {</span>
<span class="lineNum">     153 </span><span class="lineCov">          9 :   CallInfo *oldci = L-&gt;base_ci;</span>
<span class="lineNum">     154 </span><span class="lineCov">          9 :   luaM_reallocvector(L, L-&gt;base_ci, L-&gt;size_ci, newsize, CallInfo);</span>
<span class="lineNum">     155 </span><span class="lineCov">          9 :   L-&gt;size_ci = newsize;</span>
<span class="lineNum">     156 </span><span class="lineCov">          9 :   L-&gt;ci = (L-&gt;ci - oldci) + L-&gt;base_ci;</span>
<span class="lineNum">     157 </span><span class="lineCov">          9 :   L-&gt;end_ci = L-&gt;base_ci + L-&gt;size_ci - 1;</span>
<span class="lineNum">     158 </span><span class="lineCov">          9 : }</span>
<span class="lineNum">     159 </span>            : 
<span class="lineNum">     160 </span>            : 
<span class="lineNum">     161 </span><span class="lineCov">         55 : void luaD_growstack (lua_State *L, int n) {</span>
<span class="lineNum">     162 </span><span class="lineCov">         55 :   if (n &lt;= L-&gt;stacksize)  /* double size is enough? */</span>
<span class="lineNum">     163 </span><span class="lineCov">         54 :     luaD_reallocstack(L, 2*L-&gt;stacksize);</span>
<span class="lineNum">     164 </span>            :   else
<span class="lineNum">     165 </span><span class="lineCov">          1 :     luaD_reallocstack(L, L-&gt;stacksize + n);</span>
<span class="lineNum">     166 </span><span class="lineCov">         55 : }</span>
<span class="lineNum">     167 </span>            : 
<span class="lineNum">     168 </span>            : 
<span class="lineNum">     169 </span><span class="lineCov">          9 : static CallInfo *growCI (lua_State *L) {</span>
<span class="lineNum">     170 </span><span class="lineCov">          9 :   if (L-&gt;size_ci &gt; LUAI_MAXCALLS)  /* overflow while handling overflow? */</span>
<span class="lineNum">     171 </span><span class="lineNoCov">          0 :     luaD_throw(L, LUA_ERRERR);</span>
<span class="lineNum">     172 </span>            :   else {
<span class="lineNum">     173 </span><span class="lineCov">          9 :     luaD_reallocCI(L, 2*L-&gt;size_ci);</span>
<span class="lineNum">     174 </span><span class="lineCov">          9 :     if (L-&gt;size_ci &gt; LUAI_MAXCALLS)</span>
<span class="lineNum">     175 </span><span class="lineNoCov">          0 :       luaG_runerror(L, &quot;stack overflow&quot;);</span>
<span class="lineNum">     176 </span>            :   }
<span class="lineNum">     177 </span><span class="lineCov">          9 :   return ++L-&gt;ci;</span>
<span class="lineNum">     178 </span>            : }
<span class="lineNum">     179 </span>            : 
<span class="lineNum">     180 </span>            : 
<span class="lineNum">     181 </span><span class="lineCov">        474 : void luaD_callhook (lua_State *L, int event, int line) {</span>
<span class="lineNum">     182 </span><span class="lineCov">        474 :   lua_Hook hook = L-&gt;hook;</span>
<span class="lineNum">     183 </span><span class="lineCov">        474 :   if (hook &amp;&amp; L-&gt;allowhook) {</span>
<span class="lineNum">     184 </span><span class="lineCov">        233 :     ptrdiff_t top = savestack(L, L-&gt;top);</span>
<span class="lineNum">     185 </span><span class="lineCov">        233 :     ptrdiff_t ci_top = savestack(L, L-&gt;ci-&gt;top);</span>
<span class="lineNum">     186 </span>            :     lua_Debug ar;
<span class="lineNum">     187 </span><span class="lineCov">        233 :     ar.event = event;</span>
<span class="lineNum">     188 </span><span class="lineCov">        233 :     ar.currentline = line;</span>
<span class="lineNum">     189 </span><span class="lineCov">        233 :     if (event == LUA_HOOKTAILRET)</span>
<span class="lineNum">     190 </span><span class="lineNoCov">          0 :       ar.i_ci = 0;  /* tail call; no debug information about it */</span>
<span class="lineNum">     191 </span>            :     else
<span class="lineNum">     192 </span><span class="lineCov">        233 :       ar.i_ci = cast_int(L-&gt;ci - L-&gt;base_ci);</span>
<span class="lineNum">     193 </span><span class="lineCov">        233 :     luaD_checkstack(L, LUA_MINSTACK);  /* ensure minimum stack size */</span>
<span class="lineNum">     194 </span><span class="lineCov">        233 :     L-&gt;ci-&gt;top = L-&gt;top + LUA_MINSTACK;</span>
<span class="lineNum">     195 </span>            :     lua_assert(L-&gt;ci-&gt;top &lt;= L-&gt;stack_last);
<span class="lineNum">     196 </span><span class="lineCov">        233 :     L-&gt;allowhook = 0;  /* cannot call hooks inside a hook */</span>
<span class="lineNum">     197 </span>            :     lua_unlock(L);
<span class="lineNum">     198 </span><span class="lineCov">        233 :     (*hook)(L, &amp;ar);</span>
<span class="lineNum">     199 </span>            :     lua_lock(L);
<span class="lineNum">     200 </span>            :     lua_assert(!L-&gt;allowhook);
<span class="lineNum">     201 </span><span class="lineCov">        233 :     L-&gt;allowhook = 1;</span>
<span class="lineNum">     202 </span><span class="lineCov">        233 :     L-&gt;ci-&gt;top = restorestack(L, ci_top);</span>
<span class="lineNum">     203 </span><span class="lineCov">        233 :     L-&gt;top = restorestack(L, top);</span>
<span class="lineNum">     204 </span>            :   }
<span class="lineNum">     205 </span><span class="lineCov">        474 : }</span>
<span class="lineNum">     206 </span>            : 
<span class="lineNum">     207 </span>            : 
<span class="lineNum">     208 </span><span class="lineCov">        453 : static StkId adjust_varargs (lua_State *L, Proto *p, int actual) {</span>
<span class="lineNum">     209 </span>            :   int i;
<span class="lineNum">     210 </span><span class="lineCov">        453 :   int nfixargs = p-&gt;numparams;</span>
<span class="lineNum">     211 </span><span class="lineCov">        453 :   Table *htab = NULL;</span>
<span class="lineNum">     212 </span>            :   StkId base, fixed;
<span class="lineNum">     213 </span><span class="lineCov">        456 :   for (; actual &lt; nfixargs; ++actual)</span>
<span class="lineNum">     214 </span><span class="lineCov">          3 :     setnilvalue(L-&gt;top++);</span>
<span class="lineNum">     215 </span>            : #if defined(LUA_COMPAT_VARARG)
<span class="lineNum">     216 </span><span class="lineCov">        453 :   if (p-&gt;is_vararg &amp; VARARG_NEEDSARG) { /* compat. with old-style vararg? */</span>
<span class="lineNum">     217 </span><span class="lineNoCov">          0 :     int nvar = actual - nfixargs;  /* number of extra arguments */</span>
<span class="lineNum">     218 </span>            :     lua_assert(p-&gt;is_vararg &amp; VARARG_HASARG);
<span class="lineNum">     219 </span><span class="lineNoCov">          0 :     luaC_checkGC(L);</span>
<span class="lineNum">     220 </span><span class="lineNoCov">          0 :     luaD_checkstack(L, p-&gt;maxstacksize);</span>
<span class="lineNum">     221 </span><span class="lineNoCov">          0 :     htab = luaH_new(L, nvar, 1);  /* create `arg' table */</span>
<span class="lineNum">     222 </span><span class="lineNoCov">          0 :     for (i=0; i&lt;nvar; i++)  /* put extra arguments into `arg' table */</span>
<span class="lineNum">     223 </span><span class="lineNoCov">          0 :       setobj2n(L, luaH_setnum(L, htab, i+1), L-&gt;top - nvar + i);</span>
<span class="lineNum">     224 </span>            :     /* store counter in field `n' */
<span class="lineNum">     225 </span><span class="lineNoCov">          0 :     setnvalue(luaH_setstr(L, htab, luaS_newliteral(L, &quot;n&quot;)), cast_num(nvar));</span>
<span class="lineNum">     226 </span>            :   }
<span class="lineNum">     227 </span>            : #endif
<span class="lineNum">     228 </span>            :   /* move fixed parameters to final position */
<span class="lineNum">     229 </span><span class="lineCov">        453 :   fixed = L-&gt;top - actual;  /* first fixed argument */</span>
<span class="lineNum">     230 </span><span class="lineCov">        453 :   base = L-&gt;top;  /* final position of first argument */</span>
<span class="lineNum">     231 </span><span class="lineCov">        474 :   for (i=0; i&lt;nfixargs; i++) {</span>
<span class="lineNum">     232 </span><span class="lineCov">         21 :     setobjs2s(L, L-&gt;top++, fixed+i);</span>
<span class="lineNum">     233 </span><span class="lineCov">         21 :     setnilvalue(fixed+i);</span>
<span class="lineNum">     234 </span>            :   }
<span class="lineNum">     235 </span>            :   /* add `arg' parameter */
<span class="lineNum">     236 </span><span class="lineCov">        453 :   if (htab) {</span>
<span class="lineNum">     237 </span><span class="lineNoCov">          0 :     sethvalue(L, L-&gt;top++, htab);</span>
<span class="lineNum">     238 </span>            :     lua_assert(iswhite(obj2gco(htab)));
<span class="lineNum">     239 </span>            :   }
<span class="lineNum">     240 </span><span class="lineCov">        453 :   return base;</span>
<span class="lineNum">     241 </span>            : }
<span class="lineNum">     242 </span>            : 
<span class="lineNum">     243 </span>            : 
<span class="lineNum">     244 </span><span class="lineCov">          6 : static StkId tryfuncTM (lua_State *L, StkId func) {</span>
<span class="lineNum">     245 </span><span class="lineCov">          6 :   const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL);</span>
<span class="lineNum">     246 </span>            :   StkId p;
<span class="lineNum">     247 </span><span class="lineCov">          6 :   ptrdiff_t funcr = savestack(L, func);</span>
<span class="lineNum">     248 </span><span class="lineCov">          6 :   if (!ttisfunction(tm))</span>
<span class="lineNum">     249 </span><span class="lineCov">          2 :     luaG_typeerror(L, func, &quot;call&quot;);</span>
<span class="lineNum">     250 </span>            :   /* Open a hole inside the stack at `func' */
<span class="lineNum">     251 </span><span class="lineCov">         12 :   for (p = L-&gt;top; p &gt; func; p--) setobjs2s(L, p, p-1);</span>
<span class="lineNum">     252 </span><span class="lineCov">          4 :   incr_top(L);</span>
<span class="lineNum">     253 </span><span class="lineCov">          4 :   func = restorestack(L, funcr);  /* previous call may change stack */</span>
<span class="lineNum">     254 </span><span class="lineCov">          4 :   setobj2s(L, func, tm);  /* tag method is the new function to be called */</span>
<span class="lineNum">     255 </span><span class="lineCov">          4 :   return func;</span>
<span class="lineNum">     256 </span>            : }
<span class="lineNum">     257 </span>            : 
<span class="lineNum">     258 </span>            : 
<span class="lineNum">     259 </span>            : 
<span class="lineNum">     260 </span>            : #define inc_ci(L) \
<span class="lineNum">     261 </span>            :   ((L-&gt;ci == L-&gt;end_ci) ? growCI(L) : \
<span class="lineNum">     262 </span>            :    (condhardstacktests(luaD_reallocCI(L, L-&gt;size_ci)), ++L-&gt;ci))
<span class="lineNum">     263 </span>            : 
<span class="lineNum">     264 </span>            : 
<span class="lineNum">     265 </span><span class="lineCov">     127857 : int luaD_precall (lua_State *L, StkId func, int nresults) {</span>
<span class="lineNum">     266 </span>            :   LClosure *cl;
<span class="lineNum">     267 </span>            :   ptrdiff_t funcr;
<span class="lineNum">     268 </span><span class="lineCov">     127857 :   if (!ttisfunction(func)) /* `func' is not a function? */</span>
<span class="lineNum">     269 </span><span class="lineCov">          6 :     func = tryfuncTM(L, func);  /* check the `function' tag method */</span>
<span class="lineNum">     270 </span><span class="lineCov">     127855 :   funcr = savestack(L, func);</span>
<span class="lineNum">     271 </span><span class="lineCov">     127855 :   cl = &amp;clvalue(func)-&gt;l;</span>
<span class="lineNum">     272 </span><span class="lineCov">     127855 :   L-&gt;ci-&gt;savedpc = L-&gt;savedpc;</span>
<span class="lineNum">     273 </span><span class="lineCov">     127855 :   if (!cl-&gt;isC) {  /* Lua function? prepare its call */</span>
<span class="lineNum">     274 </span>            :     CallInfo *ci;
<span class="lineNum">     275 </span>            :     StkId st, base;
<span class="lineNum">     276 </span><span class="lineCov">      23064 :     Proto *p = cl-&gt;p;</span>
<span class="lineNum">     277 </span><span class="lineCov">      23064 :     luaD_checkstack(L, p-&gt;maxstacksize);</span>
<span class="lineNum">     278 </span><span class="lineCov">      23064 :     func = restorestack(L, funcr);</span>
<span class="lineNum">     279 </span><span class="lineCov">      23064 :     if (!p-&gt;is_vararg) {  /* no varargs? */</span>
<span class="lineNum">     280 </span><span class="lineCov">      22611 :       base = func + 1;</span>
<span class="lineNum">     281 </span><span class="lineCov">      22611 :       if (L-&gt;top &gt; base + p-&gt;numparams)</span>
<span class="lineNum">     282 </span><span class="lineCov">       6193 :         L-&gt;top = base + p-&gt;numparams;</span>
<span class="lineNum">     283 </span>            :     }
<span class="lineNum">     284 </span>            :     else {  /* vararg function */
<span class="lineNum">     285 </span><span class="lineCov">        453 :       int nargs = cast_int(L-&gt;top - func) - 1;</span>
<span class="lineNum">     286 </span><span class="lineCov">        453 :       base = adjust_varargs(L, p, nargs);</span>
<span class="lineNum">     287 </span><span class="lineCov">        453 :       func = restorestack(L, funcr);  /* previous call may change the stack */</span>
<span class="lineNum">     288 </span>            :     }
<span class="lineNum">     289 </span><span class="lineCov">      23064 :     ci = inc_ci(L);  /* now `enter' new function */</span>
<span class="lineNum">     290 </span><span class="lineCov">      23064 :     ci-&gt;func = func;</span>
<span class="lineNum">     291 </span><span class="lineCov">      23064 :     L-&gt;base = ci-&gt;base = base;</span>
<span class="lineNum">     292 </span><span class="lineCov">      23064 :     ci-&gt;top = L-&gt;base + p-&gt;maxstacksize;</span>
<span class="lineNum">     293 </span>            :     lua_assert(ci-&gt;top &lt;= L-&gt;stack_last);
<span class="lineNum">     294 </span><span class="lineCov">      23064 :     L-&gt;savedpc = p-&gt;code;  /* starting point */</span>
<span class="lineNum">     295 </span><span class="lineCov">      23064 :     ci-&gt;tailcalls = 0;</span>
<span class="lineNum">     296 </span><span class="lineCov">      23064 :     ci-&gt;nresults = nresults;</span>
<span class="lineNum">     297 </span><span class="lineCov">     139863 :     for (st = L-&gt;top; st &lt; ci-&gt;top; st++)</span>
<span class="lineNum">     298 </span><span class="lineCov">     116799 :       setnilvalue(st);</span>
<span class="lineNum">     299 </span><span class="lineCov">      23064 :     L-&gt;top = ci-&gt;top;</span>
<span class="lineNum">     300 </span><span class="lineCov">      23064 :     if (L-&gt;hookmask &amp; LUA_MASKCALL) {</span>
<span class="lineNum">     301 </span><span class="lineCov">        298 :       L-&gt;savedpc++;  /* hooks assume 'pc' is already incremented */</span>
<span class="lineNum">     302 </span><span class="lineCov">        298 :       luaD_callhook(L, LUA_HOOKCALL, -1);</span>
<span class="lineNum">     303 </span><span class="lineCov">        298 :       L-&gt;savedpc--;  /* correct 'pc' */</span>
<span class="lineNum">     304 </span>            :     }
<span class="lineNum">     305 </span><span class="lineCov">      23064 :     return PCRLUA;</span>
<span class="lineNum">     306 </span>            :   }
<span class="lineNum">     307 </span>            :   else {  /* if is a C function, call it */
<span class="lineNum">     308 </span>            :     CallInfo *ci;
<span class="lineNum">     309 </span>            :     int n;
<span class="lineNum">     310 </span><span class="lineCov">     104791 :     luaD_checkstack(L, LUA_MINSTACK);  /* ensure minimum stack size */</span>
<span class="lineNum">     311 </span><span class="lineCov">     104791 :     ci = inc_ci(L);  /* now `enter' new function */</span>
<span class="lineNum">     312 </span><span class="lineCov">     104791 :     ci-&gt;func = restorestack(L, funcr);</span>
<span class="lineNum">     313 </span><span class="lineCov">     104791 :     L-&gt;base = ci-&gt;base = ci-&gt;func + 1;</span>
<span class="lineNum">     314 </span><span class="lineCov">     104791 :     ci-&gt;top = L-&gt;top + LUA_MINSTACK;</span>
<span class="lineNum">     315 </span>            :     lua_assert(ci-&gt;top &lt;= L-&gt;stack_last);
<span class="lineNum">     316 </span><span class="lineCov">     104791 :     ci-&gt;nresults = nresults;</span>
<span class="lineNum">     317 </span><span class="lineCov">     104791 :     if (L-&gt;hookmask &amp; LUA_MASKCALL)</span>
<span class="lineNum">     318 </span><span class="lineCov">        144 :       luaD_callhook(L, LUA_HOOKCALL, -1);</span>
<span class="lineNum">     319 </span>            :     lua_unlock(L);
<span class="lineNum">     320 </span><span class="lineCov">     104791 :     n = (*curr_func(L)-&gt;c.f)(L);  /* do the actual call */</span>
<span class="lineNum">     321 </span>            :     lua_lock(L);
<span class="lineNum">     322 </span><span class="lineCov">     104625 :     if (n &lt; 0)  /* yielding? */</span>
<span class="lineNum">     323 </span><span class="lineCov">       5948 :       return PCRYIELD;</span>
<span class="lineNum">     324 </span>            :     else {
<span class="lineNum">     325 </span><span class="lineCov">      98677 :       luaD_poscall(L, L-&gt;top - n);</span>
<span class="lineNum">     326 </span><span class="lineCov">      98677 :       return PCRC;</span>
<span class="lineNum">     327 </span>            :     }
<span class="lineNum">     328 </span>            :   }
<span class="lineNum">     329 </span>            : }
<span class="lineNum">     330 </span>            : 
<span class="lineNum">     331 </span>            : 
<span class="lineNum">     332 </span><span class="lineNoCov">          0 : static StkId callrethooks (lua_State *L, StkId firstResult) {</span>
<span class="lineNum">     333 </span><span class="lineNoCov">          0 :   ptrdiff_t fr = savestack(L, firstResult);  /* next call may change stack */</span>
<span class="lineNum">     334 </span><span class="lineNoCov">          0 :   luaD_callhook(L, LUA_HOOKRET, -1);</span>
<span class="lineNum">     335 </span><span class="lineNoCov">          0 :   if (f_isLua(L-&gt;ci)) {  /* Lua function? */</span>
<span class="lineNum">     336 </span><span class="lineNoCov">          0 :     while ((L-&gt;hookmask &amp; LUA_MASKRET) &amp;&amp; L-&gt;ci-&gt;tailcalls--) /* tail calls */</span>
<span class="lineNum">     337 </span><span class="lineNoCov">          0 :       luaD_callhook(L, LUA_HOOKTAILRET, -1);</span>
<span class="lineNum">     338 </span>            :   }
<span class="lineNum">     339 </span><span class="lineNoCov">          0 :   return restorestack(L, fr);</span>
<span class="lineNum">     340 </span>            : }
<span class="lineNum">     341 </span>            : 
<span class="lineNum">     342 </span>            : 
<span class="lineNum">     343 </span><span class="lineCov">     126230 : int luaD_poscall (lua_State *L, StkId firstResult) {</span>
<span class="lineNum">     344 </span>            :   StkId res;
<span class="lineNum">     345 </span>            :   int wanted, i;
<span class="lineNum">     346 </span>            :   CallInfo *ci;
<span class="lineNum">     347 </span><span class="lineCov">     126230 :   if (L-&gt;hookmask &amp; LUA_MASKRET)</span>
<span class="lineNum">     348 </span><span class="lineNoCov">          0 :     firstResult = callrethooks(L, firstResult);</span>
<span class="lineNum">     349 </span><span class="lineCov">     126230 :   ci = L-&gt;ci--;</span>
<span class="lineNum">     350 </span><span class="lineCov">     126230 :   res = ci-&gt;func;  /* res == final position of 1st result */</span>
<span class="lineNum">     351 </span><span class="lineCov">     126230 :   wanted = ci-&gt;nresults;</span>
<span class="lineNum">     352 </span><span class="lineCov">     126230 :   L-&gt;base = (ci - 1)-&gt;base;  /* restore base */</span>
<span class="lineNum">     353 </span><span class="lineCov">     126230 :   L-&gt;savedpc = (ci - 1)-&gt;savedpc;  /* restore savedpc */</span>
<span class="lineNum">     354 </span>            :   /* move results to correct place */
<span class="lineNum">     355 </span><span class="lineCov">     270100 :   for (i = wanted; i != 0 &amp;&amp; firstResult &lt; L-&gt;top; i--)</span>
<span class="lineNum">     356 </span><span class="lineCov">     143870 :     setobjs2s(L, res++, firstResult++);</span>
<span class="lineNum">     357 </span><span class="lineCov">     138557 :   while (i-- &gt; 0)</span>
<span class="lineNum">     358 </span><span class="lineCov">      12327 :     setnilvalue(res++);</span>
<span class="lineNum">     359 </span><span class="lineCov">     126230 :   L-&gt;top = res;</span>
<span class="lineNum">     360 </span><span class="lineCov">     126230 :   return (wanted - LUA_MULTRET);  /* 0 iff wanted == LUA_MULTRET */</span>
<span class="lineNum">     361 </span>            : }
<span class="lineNum">     362 </span>            : 
<span class="lineNum">     363 </span>            : 
<span class="lineNum">     364 </span>            : /*
<span class="lineNum">     365 </span>            : ** Call a function (C or Lua). The function to be called is at *func.
<span class="lineNum">     366 </span>            : ** The arguments are on the stack, right after the function.
<span class="lineNum">     367 </span>            : ** When returns, all the results are on the stack, starting at the original
<span class="lineNum">     368 </span>            : ** function position.
<span class="lineNum">     369 </span>            : */ 
<span class="lineNum">     370 </span><span class="lineCov">      56963 : void luaD_call (lua_State *L, StkId func, int nResults) {</span>
<span class="lineNum">     371 </span><span class="lineCov">      56963 :   if (++L-&gt;nCcalls &gt;= LUAI_MAXCCALLS) {</span>
<span class="lineNum">     372 </span><span class="lineNoCov">          0 :     if (L-&gt;nCcalls == LUAI_MAXCCALLS)</span>
<span class="lineNum">     373 </span><span class="lineNoCov">          0 :       luaG_runerror(L, &quot;C stack overflow&quot;);</span>
<span class="lineNum">     374 </span><span class="lineNoCov">          0 :     else if (L-&gt;nCcalls &gt;= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS&gt;&gt;3)))</span>
<span class="lineNum">     375 </span><span class="lineNoCov">          0 :       luaD_throw(L, LUA_ERRERR);  /* error while handing stack error */</span>
<span class="lineNum">     376 </span>            :   }
<span class="lineNum">     377 </span><span class="lineCov">      56963 :   if (luaD_precall(L, func, nResults) == PCRLUA)  /* is a Lua function? */</span>
<span class="lineNum">     378 </span><span class="lineCov">       7006 :     luaV_execute(L, 1);  /* call it */</span>
<span class="lineNum">     379 </span><span class="lineCov">      56607 :   L-&gt;nCcalls--;</span>
<span class="lineNum">     380 </span><span class="lineCov">      56607 :   luaC_checkGC(L);</span>
<span class="lineNum">     381 </span><span class="lineCov">      56607 : }</span>
<span class="lineNum">     382 </span>            : 
<span class="lineNum">     383 </span>            : 
<span class="lineNum">     384 </span><span class="lineCov">       5962 : static void resume (lua_State *L, void *ud) {</span>
<span class="lineNum">     385 </span><span class="lineCov">       5962 :   StkId firstArg = cast(StkId, ud);</span>
<span class="lineNum">     386 </span><span class="lineCov">       5962 :   CallInfo *ci = L-&gt;ci;</span>
<span class="lineNum">     387 </span><span class="lineCov">       5962 :   if (L-&gt;status == 0) {  /* start coroutine? */</span>
<span class="lineNum">     388 </span>            :     lua_assert(ci == L-&gt;base_ci &amp;&amp; firstArg &gt; L-&gt;base);
<span class="lineNum">     389 </span><span class="lineCov">         16 :     if (luaD_precall(L, firstArg - 1, LUA_MULTRET) != PCRLUA)</span>
<span class="lineNum">     390 </span><span class="lineNoCov">          0 :       return;</span>
<span class="lineNum">     391 </span>            :   }
<span class="lineNum">     392 </span>            :   else {  /* resuming from previous yield */
<span class="lineNum">     393 </span>            :     lua_assert(L-&gt;status == LUA_YIELD);
<span class="lineNum">     394 </span><span class="lineCov">       5946 :     L-&gt;status = 0;</span>
<span class="lineNum">     395 </span><span class="lineCov">       5946 :     if (!f_isLua(ci)) {  /* `common' yield? */</span>
<span class="lineNum">     396 </span>            :       /* finish interrupted execution of `OP_CALL' */
<span class="lineNum">     397 </span>            :       lua_assert(GET_OPCODE(*((ci-1)-&gt;savedpc - 1)) == OP_CALL ||
<span class="lineNum">     398 </span>            :                  GET_OPCODE(*((ci-1)-&gt;savedpc - 1)) == OP_TAILCALL);
<span class="lineNum">     399 </span><span class="lineCov">       5946 :       if (luaD_poscall(L, firstArg))  /* complete it... */</span>
<span class="lineNum">     400 </span><span class="lineCov">       5945 :         L-&gt;top = L-&gt;ci-&gt;top;  /* and correct top if not multiple results */</span>
<span class="lineNum">     401 </span>            :     }
<span class="lineNum">     402 </span>            :     else  /* yielded inside a hook: just continue its execution */
<span class="lineNum">     403 </span><span class="lineNoCov">          0 :       L-&gt;base = L-&gt;ci-&gt;base;</span>
<span class="lineNum">     404 </span>            :   }
<span class="lineNum">     405 </span><span class="lineCov">       5962 :   luaV_execute(L, cast_int(L-&gt;ci - L-&gt;base_ci));</span>
<span class="lineNum">     406 </span>            : }
<span class="lineNum">     407 </span>            : 
<span class="lineNum">     408 </span>            : 
<span class="lineNum">     409 </span><span class="lineNoCov">          0 : static int resume_error (lua_State *L, const char *msg) {</span>
<span class="lineNum">     410 </span><span class="lineNoCov">          0 :   L-&gt;top = L-&gt;ci-&gt;base;</span>
<span class="lineNum">     411 </span><span class="lineNoCov">          0 :   setsvalue2s(L, L-&gt;top, luaS_new(L, msg));</span>
<span class="lineNum">     412 </span><span class="lineNoCov">          0 :   incr_top(L);</span>
<span class="lineNum">     413 </span>            :   lua_unlock(L);
<span class="lineNum">     414 </span><span class="lineNoCov">          0 :   return LUA_ERRRUN;</span>
<span class="lineNum">     415 </span>            : }
<span class="lineNum">     416 </span>            : 
<span class="lineNum">     417 </span>            : 
<span class="lineNum">     418 </span><span class="lineCov">       5962 : LUA_API int lua_resume (lua_State *L, int nargs) {</span>
<span class="lineNum">     419 </span>            :   int status;
<span class="lineNum">     420 </span>            :   lua_lock(L);
<span class="lineNum">     421 </span><span class="lineCov">       5962 :   if (L-&gt;status != LUA_YIELD &amp;&amp; (L-&gt;status != 0 || L-&gt;ci != L-&gt;base_ci))</span>
<span class="lineNum">     422 </span><span class="lineNoCov">          0 :       return resume_error(L, &quot;cannot resume non-suspended coroutine&quot;);</span>
<span class="lineNum">     423 </span><span class="lineCov">       5962 :   if (L-&gt;nCcalls &gt;= LUAI_MAXCCALLS)</span>
<span class="lineNum">     424 </span><span class="lineNoCov">          0 :     return resume_error(L, &quot;C stack overflow&quot;);</span>
<span class="lineNum">     425 </span>            :   luai_userstateresume(L, nargs);
<span class="lineNum">     426 </span>            :   lua_assert(L-&gt;errfunc == 0);
<span class="lineNum">     427 </span><span class="lineCov">       5962 :   L-&gt;baseCcalls = ++L-&gt;nCcalls;</span>
<span class="lineNum">     428 </span><span class="lineCov">       5962 :   status = luaD_rawrunprotected(L, resume, L-&gt;top - nargs);</span>
<span class="lineNum">     429 </span><span class="lineCov">       5962 :   if (status != 0) {  /* error? */</span>
<span class="lineNum">     430 </span><span class="lineCov">          1 :     L-&gt;status = cast_byte(status);  /* mark thread as `dead' */</span>
<span class="lineNum">     431 </span><span class="lineCov">          1 :     luaD_seterrorobj(L, status, L-&gt;top);</span>
<span class="lineNum">     432 </span><span class="lineCov">          1 :     L-&gt;ci-&gt;top = L-&gt;top;</span>
<span class="lineNum">     433 </span>            :   }
<span class="lineNum">     434 </span>            :   else {
<span class="lineNum">     435 </span>            :     lua_assert(L-&gt;nCcalls == L-&gt;baseCcalls);
<span class="lineNum">     436 </span><span class="lineCov">       5961 :     status = L-&gt;status;</span>
<span class="lineNum">     437 </span>            :   }
<span class="lineNum">     438 </span><span class="lineCov">       5962 :   --L-&gt;nCcalls;</span>
<span class="lineNum">     439 </span>            :   lua_unlock(L);
<span class="lineNum">     440 </span><span class="lineCov">       5962 :   return status;</span>
<span class="lineNum">     441 </span>            : }
<span class="lineNum">     442 </span>            : 
<span class="lineNum">     443 </span>            : 
<span class="lineNum">     444 </span><span class="lineCov">       5949 : LUA_API int lua_yield (lua_State *L, int nresults) {</span>
<span class="lineNum">     445 </span>            :   luai_userstateyield(L, nresults);
<span class="lineNum">     446 </span>            :   lua_lock(L);
<span class="lineNum">     447 </span><span class="lineCov">       5949 :   if (L-&gt;nCcalls &gt; L-&gt;baseCcalls)</span>
<span class="lineNum">     448 </span><span class="lineCov">          1 :     luaG_runerror(L, &quot;attempt to yield across metamethod/C-call boundary&quot;);</span>
<span class="lineNum">     449 </span><span class="lineCov">       5948 :   L-&gt;base = L-&gt;top - nresults;  /* protect stack slots below */</span>
<span class="lineNum">     450 </span><span class="lineCov">       5948 :   L-&gt;status = LUA_YIELD;</span>
<span class="lineNum">     451 </span>            :   lua_unlock(L);
<span class="lineNum">     452 </span><span class="lineCov">       5948 :   return -1;</span>
<span class="lineNum">     453 </span>            : }
<span class="lineNum">     454 </span>            : 
<span class="lineNum">     455 </span>            : 
<span class="lineNum">     456 </span><span class="lineCov">       1313 : int luaD_pcall (lua_State *L, Pfunc func, void *u,</span>
<span class="lineNum">     457 </span>            :                 ptrdiff_t old_top, ptrdiff_t ef) {
<span class="lineNum">     458 </span>            :   int status;
<span class="lineNum">     459 </span><span class="lineCov">       1313 :   unsigned short oldnCcalls = L-&gt;nCcalls;</span>
<span class="lineNum">     460 </span><span class="lineCov">       1313 :   ptrdiff_t old_ci = saveci(L, L-&gt;ci);</span>
<span class="lineNum">     461 </span><span class="lineCov">       1313 :   lu_byte old_allowhooks = L-&gt;allowhook;</span>
<span class="lineNum">     462 </span><span class="lineCov">       1313 :   ptrdiff_t old_errfunc = L-&gt;errfunc;</span>
<span class="lineNum">     463 </span><span class="lineCov">       1313 :   L-&gt;errfunc = ef;</span>
<span class="lineNum">     464 </span><span class="lineCov">       1313 :   status = luaD_rawrunprotected(L, func, u);</span>
<span class="lineNum">     465 </span><span class="lineCov">       1296 :   if (status != 0) {  /* an error occurred? */</span>
<span class="lineNum">     466 </span><span class="lineCov">        371 :     StkId oldtop = restorestack(L, old_top);</span>
<span class="lineNum">     467 </span><span class="lineCov">        371 :     luaF_close(L, oldtop);  /* close eventual pending closures */</span>
<span class="lineNum">     468 </span><span class="lineCov">        371 :     luaD_seterrorobj(L, status, oldtop);</span>
<span class="lineNum">     469 </span><span class="lineCov">        371 :     L-&gt;nCcalls = oldnCcalls;</span>
<span class="lineNum">     470 </span><span class="lineCov">        371 :     L-&gt;ci = restoreci(L, old_ci);</span>
<span class="lineNum">     471 </span><span class="lineCov">        371 :     L-&gt;base = L-&gt;ci-&gt;base;</span>
<span class="lineNum">     472 </span><span class="lineCov">        371 :     L-&gt;savedpc = L-&gt;ci-&gt;savedpc;</span>
<span class="lineNum">     473 </span><span class="lineCov">        371 :     L-&gt;allowhook = old_allowhooks;</span>
<span class="lineNum">     474 </span><span class="lineCov">        371 :     restore_stack_limit(L);</span>
<span class="lineNum">     475 </span>            :   }
<span class="lineNum">     476 </span><span class="lineCov">       1296 :   L-&gt;errfunc = old_errfunc;</span>
<span class="lineNum">     477 </span><span class="lineCov">       1296 :   return status;</span>
<span class="lineNum">     478 </span>            : }
<span class="lineNum">     479 </span>            : 
<span class="lineNum">     480 </span>            : 
<span class="lineNum">     481 </span>            : 
<span class="lineNum">     482 </span>            : /*
<span class="lineNum">     483 </span>            : ** Execute a protected parser.
<span class="lineNum">     484 </span>            : */
<span class="lineNum">     485 </span>            : struct SParser {  /* data to `f_parser' */
<span class="lineNum">     486 </span>            :   ZIO *z;
<span class="lineNum">     487 </span>            :   Mbuffer buff;  /* buffer to be used by the scanner */
<span class="lineNum">     488 </span>            :   const char *name;
<span class="lineNum">     489 </span>            : };
<span class="lineNum">     490 </span>            : 
<span class="lineNum">     491 </span><span class="lineCov">        488 : static void f_parser (lua_State *L, void *ud) {</span>
<span class="lineNum">     492 </span>            :   int i;
<span class="lineNum">     493 </span>            :   Proto *tf;
<span class="lineNum">     494 </span>            :   Closure *cl;
<span class="lineNum">     495 </span><span class="lineCov">        488 :   struct SParser *p = cast(struct SParser *, ud);</span>
<span class="lineNum">     496 </span><span class="lineCov">        488 :   int c = luaZ_lookahead(p-&gt;z);</span>
<span class="lineNum">     497 </span><span class="lineCov">        487 :   luaC_checkGC(L);</span>
<span class="lineNum">     498 </span><span class="lineCov">        487 :   tf = ((c == LUA_SIGNATURE[0]) ? luaU_undump : luaY_parser)(L, p-&gt;z,</span>
<span class="lineNum">     499 </span>            :                                                              &amp;p-&gt;buff, p-&gt;name);
<span class="lineNum">     500 </span><span class="lineCov">        451 :   cl = luaF_newLclosure(L, tf-&gt;nups, hvalue(gt(L)));</span>
<span class="lineNum">     501 </span><span class="lineCov">        451 :   cl-&gt;l.p = tf;</span>
<span class="lineNum">     502 </span><span class="lineCov">        451 :   for (i = 0; i &lt; tf-&gt;nups; i++)  /* initialize eventual upvalues */</span>
<span class="lineNum">     503 </span><span class="lineNoCov">          0 :     cl-&gt;l.upvals[i] = luaF_newupval(L);</span>
<span class="lineNum">     504 </span><span class="lineCov">        451 :   setclvalue(L, L-&gt;top, cl);</span>
<span class="lineNum">     505 </span><span class="lineCov">        451 :   incr_top(L);</span>
<span class="lineNum">     506 </span><span class="lineCov">        451 : }</span>
<span class="lineNum">     507 </span>            : 
<span class="lineNum">     508 </span>            : 
<span class="lineNum">     509 </span><span class="lineCov">        488 : int luaD_protectedparser (lua_State *L, ZIO *z, const char *name) {</span>
<span class="lineNum">     510 </span>            :   struct SParser p;
<span class="lineNum">     511 </span>            :   int status;
<span class="lineNum">     512 </span><span class="lineCov">        488 :   p.z = z; p.name = name;</span>
<span class="lineNum">     513 </span><span class="lineCov">        488 :   luaZ_initbuffer(L, &amp;p.buff);</span>
<span class="lineNum">     514 </span><span class="lineCov">        488 :   status = luaD_pcall(L, f_parser, &amp;p, savestack(L, L-&gt;top), L-&gt;errfunc);</span>
<span class="lineNum">     515 </span><span class="lineCov">        488 :   luaZ_freebuffer(L, &amp;p.buff);</span>
<span class="lineNum">     516 </span><span class="lineCov">        488 :   return status;</span>
<span class="lineNum">     517 </span>            : }
<span class="lineNum">     518 </span>            : 
<span class="lineNum">     519 </span>            : 
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.13</a></td></tr>
  </table>
  <br>

</body>
</html>
